﻿<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>操作DOM-jQuery基础</title>
<style>
.aclss{background: #666;font-size: 2.8rem;}
.aclss2{background: #ff0;font-size: 2.8rem;}
</style>
</head>
<body>
<span id="a1">逐浪软件创造中国辉煌</span>
<hr>
<div class="a2">你好</div>
<hr>
<div class="a3">外婆你在天堂好吗</div>

<h1>对元素值进行操作</h1>
<select name="like" id="like" multiple="multiple" size="3">
<option >列表项1</option>
<option selected>列表项2</option>
<option selected>列表项3</option>

</select>
<select name="like2" id="like2" multiple="multiple" size="3">
<option >列表22项1</option>
<option selected>列22表2项2</option>
<option selected>列表222项3</option>

</select>

<div id="like3">
<input type="text" name="users"/>

</div>


<script type="text/javascript" src="jquery-3.5.1.min.js"></script>   
<script type="text/javascript">
$(document).ready(function () {
    const t1=$(`#a1`).text();
    // alert(t1);
    $(`.a2`).text(`我是通过text()方法写入的文本内容,以及`+t1);
    $(`#like2`).val(['列表22项1','列22表2项2']);
   // alert($(`#like2`).val())
    $(`#like3 input:text`).val(`这是传值进来的`);
    alert($(`#like3 input:text`).val())

})


</script>

</body>
</html>
